<script type="text/javascript" src="<?=site_url()?>js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<?=site_url()?>js/punvalidate.js"></script>

<script>
$(document).ready(function(){
	$("#br1").click(function(){
		document.getElementById('mapArea').src = document.getElementById('bri1').value;
	});
	$("#br2").click(function(){
		document.getElementById('mapArea').src = document.getElementById('bri2').value;
	});
	$("#br3").click(function(){
		document.getElementById('mapArea').src = document.getElementById('bri3').value;
	});
	$("#br4").click(function(){
		document.getElementById('mapArea').src = document.getElementById('bri4').value;
	});
	$("#br5").click(function(){
		document.getElementById('mapArea').src = document.getElementById('bri5').value;
	});
	$("#btnSubmit").click(function(){
		if(trim(document.getElementById('txtName').value).length == 0) {
			document.getElementById('txtName').focus();
			alert("กรุณาใส่ชื่อ");
			return;		
		}  

		if(trim(document.getElementById('txtEmail').value).length == 0) {
			document.getElementById('txtEmail').focus();
			alert("กรุณาใส่อีเมลล์");
			return;		
		}  

		if(isValidEmailAddress(document.getElementById('txtEmail').value) == false) {
			document.getElementById('txtEmail').focus();
			alert('รูปแบบอีเมล์ไม่ถูกต้อง');
			return;
		}

		if(trim(document.getElementById('txtTel').value).length == 0) {
			document.getElementById('txtTel').focus();
			alert("กรุณาใส่เบอร์โทรศัพท์");
			return;		
		}

		if(isTelNo(document.getElementById('txtTel').value) == false) {
			document.getElementById('txtTel').focus();
			alert('รูปแบบเบอร์โทรศัพท์ไม่ถูกต้อง');
			return;
		}
		
		if(trim(document.getElementById('txtNote').value).length == 0) {
			document.getElementById('txtNote').focus();
			alert("กรุณาใส่ข้อความ");
			return;		
		}
		if(trim(document.getElementById('txtCap').value).length == 0) {
			document.getElementById('txtCap').focus();
			alert("กรุณาใส่ Security Code");
			return;		
		}    
		
		
		document.forms["myForm"].submit();
	});
});
</script>
<table width="915" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr>
        <td width="86"><img src="<?=site_url()?>images/contact_14.jpg" width="86" height="1600" alt="" /></td>
        <td width="739" height="1392" valign="top" bgcolor="#ffffff"><table width="739" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="617" height="108" bgcolor="#FFFFFF"><img src="<?=site_url()?>images/contact_16.jpg" width="617" height="108" /></td>
            <td width="121" height="108"><img src="<?=site_url()?>images/contact_17.jpg" width="121" height="108" /></td>
          </tr>
          <tr>
            <td height="73" colspan="2" bgcolor="#FFFFFF"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><p class="style2"><img src="<?=site_url()?>images/buttomaward_19.jpg" width="70" height="15" /> <?php if($contact_intro['longd']) {echo ereg_replace("\n", "<br>", $contact_intro['longd']); }?></p></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="356" colspan="2" bgcolor="#FFFFFF"><table id="Table_" width="739" height="357" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="9" colspan="5"><img src="<?=site_url()?>images/contact_20_01.jpg" width="370" height="9" alt="" /></td>
                <td colspan="6"><img src="<?=site_url()?>images/contact_20_02.jpg" width="369" height="9" alt="" /></td>
              </tr>
              <tr>
                <td height="200" colspan="2">&nbsp;</td>
                <td colspan="3"><?php if(isset($contact_01['file_name'])) {
		      				echo '<img src="'. site_url() . 'data-image/file_management/' . $contact_01['file_name']  .'" width="300" height="200" />';
		      			} else {
		      				echo '<img src="'. site_url() . 'data-image/file_management/noImg.jpg" width="300" height="200" />';
		      			}?></td>
                <td>&nbsp;</td>
                <td colspan="3"><?php if(isset($contact_02['file_name'])) {
		      				echo '<img src="'. site_url() . 'data-image/file_management/' . $contact_02['file_name']  .'" width="295" height="200" />';
		      			} else {
		      				echo '<img src="'. site_url() . 'data-image/file_management/noImg.jpg" width="295" height="200" />';
		      			}?></td>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="11"><img src="<?=site_url()?>images/contact_20_08.jpg" width="739" height="5" alt="" /></td>
              </tr>
              <tr>
                <td height="131">&nbsp;</td>
                <td colspan="2"><?php if(isset($contact_03['file_name'])) {
		      				echo '<img src="'. site_url() . 'data-image/file_management/' . $contact_03['file_name']  .'" width="198" height="131" />';
		      			} else {
		      				echo '<img src="'. site_url() . 'data-image/file_management/noImg.jpg" width="198" height="131" />';
		      			}?></td>
                <td>&nbsp;</td>
                <td colspan="3"><?php if(isset($contact_04['file_name'])) {
		      				echo '<img src="'. site_url() . 'data-image/file_management/' . $contact_04['file_name']  .'" width="198" height="131" />';
		      			} else {
		      				echo '<img src="'. site_url() . 'data-image/file_management/noImg.jpg" width="198" height="131" />';
		      			}?></td>
                <td>&nbsp;</td>
                <td colspan="2"><?php if(isset($contact_05['file_name'])) {
		      				echo '<img src="'. site_url() . 'data-image/file_management/' . $contact_05['file_name']  .'" width="198" height="131" />';
		      			} else {
		      				echo '<img src="'. site_url() . 'data-image/file_management/noImg.jpg" width="198" height="131" />';
		      			}?></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td height="11" colspan="11"><img src="<?=site_url()?>images/contact_20_16.jpg" width="739" height="11" alt="" /></td>
              </tr>
              <tr>
                <td><img src="<?=site_url()?>images/spacer.gif" width="69" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="1" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="197" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="8" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="95" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="13" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="90" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="8" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="197" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="1" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="60" height="1" alt="" /></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="416" colspan="2" bgcolor="#FFFFFF"><table id="Table_01" width="739" height="417" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td height="43" colspan="3" width="738" background="<?=site_url()?>images/contact_21_01.jpg"><a name="map">&nbsp;</a></td>
                <td><img src="<?=site_url()?>images/contact_21_02.jpg" width="1" height="43" alt="" /></td>
              </tr>
              <tr>
                <td height="314" colspan="4"><table id="Table_2" width="739" height="314" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="74" height="314" background="<?=site_url()?>images/contact_21_03_01.jpg"></td>
                    <td><?php if(isset($contact_map_01['file_name'])) {
		      				echo '<img id="mapArea" src="'. site_url() . 'data-image/file_management/' . $contact_map_01['file_name']  .'" width="602" height="310" />';
		      			}?>
                    </td>
                    <td><img src="<?=site_url()?>images/contact_21_03_03.jpg" width="63" height="314" alt="" /></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="36"><img src="<?=site_url()?>images/contact_21_04.jpg" width="90" height="36" alt="" /></td>
                <td colspan="3" width="649px" background="<?=site_url()?>images/contact_21_06.jpg">
                	<?php 
                		if($contact_map_01['file_name'] != "" && $contact_map_01['detail'] != "" ) {
                			echo ' <input type="button" id="br1" value=" '.$contact_map_01['detail'].' " style="border: 2px solid #00ff0; background:#ffffff; color:#007f44; ">';
                			echo '<input type="hidden" id="bri1" value="'.site_url(). 'data-image/file_management/' .$contact_map_01['file_name'].'">';
                		}
                		
                		if($contact_map_02['file_name'] != "" && $contact_map_02['detail'] != "" ) {
                			echo ' <input type="button" id="br2" value=" '.$contact_map_02['detail'].' " style="border: 2px solid #00ff0; background:#ffffff; color:#007f44; ">';
                			echo '<input type="hidden" id="bri2" value="'.site_url().'data-image/file_management/' .$contact_map_02['file_name'].'">';
                		}
                		if($contact_map_03['file_name'] != "" && $contact_map_03['detail'] != "" ) {
                			echo ' <input type="button" id="br3" value=" '.$contact_map_03['detail'].' " style="border: 2px solid #00ff0; background:#ffffff; color:#007f44; ">';
                			echo '<input type="hidden" id="bri3" value="'.site_url().'data-image/file_management/' .$contact_map_03['file_name'].'">';
                		}
                		
                		if($contact_map_04['file_name'] != "" && $contact_map_04['detail'] != "" ) {
                			echo ' <input type="button" id="br4" value=" '.$contact_map_04['detail'].' " style="border: 2px solid #00ff0; background:#ffffff; color:#007f44; ">';
                			echo '<input type="hidden" id="bri4" value="'.site_url().'data-image/file_management/' .$contact_map_04['file_name'].'">';
                		}
                		if($contact_map_05['file_name'] != "" && $contact_map_05['detail'] != "" ) {
                			echo ' <input type="button" id="br5" value=" '.$contact_map_05['detail'].' " style="border: 2px solid #00ff0; background:#ffffff; color:#007f44; ">';
                			echo '<input type="hidden" id="bri5" value="'.site_url().'data-image/file_management/' .$contact_map_05['file_name'].'">';
                		}
                	?>
                	
                </td>
              </tr>
              <tr>
                <td height="23" colspan="4"><img src="<?=site_url()?>images/contact_21_07.jpg" width="739" height="23" alt="" /></td>
              </tr>
              <tr>
                <td><img src="<?=site_url()?>images/spacer.gif" width="90" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="106" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="542" height="1" alt="" /></td>
                <td><img src="<?=site_url()?>images/spacer.gif" width="1" height="1" alt="" /></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="61" colspan="2" bgcolor="#FFFFFF"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td align="center"><p class="style2" ><?php if(isset($contact_cont['longd'])) {
		      			echo $contact_cont['longd']; }    ?></p></td>
              </tr>
            </table></td>
            </tr>
          <tr>
            <td height="378" colspan="2"><table width="739" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
              <tr>
                <td width="160" height="378" ><img src="<?=site_url()?>images/contact_23.jpg" width="160" height="379" alt="" /></td>
                <td width="579" bgcolor="#FFFFFF">
                <form name="myForm" method="post" action="<?=site_url()?>contact/send">
                <table width="579" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="100" height="41" bgcolor="#FFFFFF" class="style2">ชื่อ<span class="red">*</span></td>
                    <td width="496" height="41"><input type="text" id="txtName" value="<?php if(isset($name)) echo $name;?>" name="txtName" maxlength="70" style="width: 250px; border: 4px solid #007f44;" /> </td>
                  </tr>
                  <tr>
                    <td height="40" bgcolor="#FFFFFF" class="style2">อีเมลล์<span class="red">*</span></td>
                    <td width="496" height="40" ><input type="text" name="txtEmail" id="txtEmail" value="<?php if(isset($mail)) echo $mail;?>" style="width: 250px;  border: 4px solid #007f44;" /></td>
                  </tr>
                  <tr>
                    <td height="41" bgcolor="#FFFFFF" class="style2">เบอร์โทรศัพท์<span class="red">*</span></td>
                    <td width="496" height="41" ><input type="text" id="txtTel" name="txtTel" value="<?php if(isset($tel)) echo $tel;?>" style="width: 250px;  border: 4px solid #007f44;" /></td>
                  </tr>
                  <tr>
                    <td height="28" colspan="2" bgcolor="#FFFFFF" class="style2">เวลาที่สะดวกที่ให้ติดต่อทางโทรศัพท์</td>
                  </tr>
                  <tr>
                    <td height="41"><img src="<?=site_url()?>images/contact_31.jpg" width="83" height="41" alt="" /></td>
                    <td width="496" height="41" ><input type="text" id="txtTime" name="txtTime" value="<?php if(isset($time)) echo $time;?>" style="width: 250px;  border: 4px solid #007f44;" /> </td>
                  </tr>
                  <tr>
                    <td height="39" bgcolor="#FFFFFF" class="style2">ข้อความ<span class="red">*</span></td>
                    <td width="496" height="152" rowspan="2">
                    	<textarea rows="7" cols="25" name="txtNote" id="txtNote" style="width: 250px; border: 4px solid #007f44;"><?php if(isset($note)) echo $note;?></textarea></td>
                  </tr>
                  
                  <tr>
                    <td height="113"><img src="<?=site_url()?>images/contact_35.jpg" width="83" height="113" alt="" /></td>
                  </tr>
                  <tr>
                    <td height="60" bgcolor="#FFFFFF" class="style2" valign="top"> Security Code<span class="red">*</span></td>
                    <td width="496" height="60" valign="top" >
                    	<?php echo $cap['image'];?> <br/><br/><input type="text" id="txtCap" name="txtCap" style="width: 130px;  border: 4px solid #007f44; height:30px" />	
					</td>
                  </tr>
                  <tr>
                    <td height="35" colspan="2"><table width="579" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="35" bgcolor="#FFFFFF"><table width="579" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td width="166" height="36" bgcolor="#FFFFFF">&nbsp;</td>
                            <td width="110" height="35"><br/><a id="btnSubmit" name="btn" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image38','','<?=site_url()?>images/contactroll_37.jpg',1)"><img src="<?=site_url()?>images/contact_37.jpg" name="Image38" width="110" height="35" border="0" id="Image38" /></a></td>
                            <td width="303" height="36" bgcolor="#FFFFFF">&nbsp;</td>
                          </tr>
                        </table></td>
                        </tr>
                    </table></td>
                  </tr>
                </table></form></td>
              </tr>
            </table></td>
            </tr>
        </table></td>
        <td width="90" bgcolor="#FFFFFF"><img src="<?=site_url()?>images/contact_18.jpg" width="90" height="1600" alt="" /></td>
      </tr>
    </table>